home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1998 May / PCPlus May 1998=disk A.iso / trial / gdldb / disk1 / data1.cab / Example_Files / workweb3.scp < prev   
Encoding:
Text File  |  1998-01-21  |  4.8 KB  |  218 lines

  1. ##########################################################
  2. # GDIdB demo script (c) 1997 Global Data Industries
  3. # Datasource=workweb.mdb (Access database)
  4. #
  5. # If you have a large table of data that you'd like to
  6. # split across several HTML pages, study this script
  7. # for hints on how to do it.
  8. ##########################################################
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15. ##########################################################
  16. # Declare variables used in script
  17.  
  18. &defvar(?var1?,?categorysize?)
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25. ##########################################################
  26. # ?categorysize? sets the amount of jobs that are placed
  27. # on each page. try changing the value from 3 to 4 to see
  28. # the effect.
  29.  
  30. &assign(?categorysize?,3)
  31.  
  32.  
  33.  
  34.  
  35.  
  36. ##########################################################
  37. # Print the script information screen
  38.  
  39. &cls
  40. &print("WorkWeb 3 Demo Script")
  41. &print("------------------------------------")
  42.  
  43.  
  44.  
  45.  
  46.  
  47. ##########################################################
  48. # Declare the database file.
  49.  
  50. &datasource("Driver={Microsoft Access Driver (*.mdb)};DBQ=workweb.mdb")
  51.  
  52.  
  53.  
  54.  
  55.  
  56. ##########################################################
  57. # Start generating the HTML
  58.  
  59. &html("index.html")
  60. {
  61.     <HTML>
  62.     <HEAD>
  63.     <TITLE>Work Web</TITLE>
  64.     </HEAD>
  65.     <BODY BACKGROUND="wwbg1.gif" LINK=BLACK VLINK=BLACK ALINK=WHITE>
  66.     <FONT FACE="Verdana,Helvetica">
  67.     <IMG SRC="ww1.gif">
  68.     <BR><BR><BR><BR><BR><BR>
  69.     <TABLE CELLPADDING=10 CELLSPACING=10 BORDER=0 WIDTH="100%">
  70.     <TR>
  71.     <TD VALIGN=TOP>
  72.     <FONT FACE="Verdana,Helvetica">
  73.  
  74.     # select all of the data in the "jobs" table
  75.     &sql("SELECT * FROM Jobs")
  76.     {
  77.         # only create job pages & links if the database
  78.         # actually contains some vacancies!
  79.         &if(?recordsetsize?>0)
  80.         {
  81.             <FONT SIZE="+2">Select a link:</FONT>
  82.             <UL><UL>
  83.  
  84.             # repeat this block as long as there is still data
  85.             # to process
  86.             &while(?recordsetsize?>?rownumber?)
  87.             {
  88.                 &assign(?var1?,?rownumber?+?categorysize?-1)
  89.                 <A HREF="content?rownumber?.html">Jobs ?rownumber?-?var1?</A><BR>
  90.  
  91.                 # create a page with ?categorysize? number of
  92.                 # jobs on it (by calling subroutine &datapage)
  93.                 &datapage
  94.             }
  95.  
  96.             </UL></UL>
  97.         }
  98.  
  99.         # if there's no data in the database, print a sorry message
  100.         &else
  101.         {
  102.             <FONT SIZE="+2">Sorry!<BR>The database is currently empty.</FONT>
  103.         }
  104.     }
  105.  
  106.     </FONT>
  107.     </TD>
  108.     <TD WIDTH="45%" VALIGN=TOP><FONT FACE="Verdana,Helvetica">
  109.     <B>This Site</B>  demonstrates the use of GDI's Database
  110.     publishing software. A database consisting of
  111.     a large table of jobs is broken down into manageable
  112.     chunks before being merged with the web site
  113.     HTML and passed to the web server <I>automatically.</I> 
  114.     </FONT>
  115.     </TD>
  116.     </TR>
  117.     </TABLE>
  118.     <BR><BR><BR>
  119.     <TABLE CELLPADDING=10 CELLSPACING=10 BORDER=0 WIDTH="100%">
  120.     <TR>
  121.     <TD>
  122.     <FONT FACE="Verdana,Helvetica"> 
  123.     <B>System Bullet points:</B>
  124.     <UL>
  125.     <LI> Totally automated publishing of database and spreadsheet data using a dial-up Internet connection.
  126.     <LI> The database does not need to be stored on the web server.
  127.     <LI> No specialist knowledge is required by web site maintainer.
  128.     <LI> Zero administration overhead- Just set the times/days when you
  129.     want to update your web site from your database and forget it!
  130.     </UL>
  131.     </FONT>
  132.     </TD>
  133.     </TR>
  134.     </TABLE>
  135.     <CENTER>
  136.     <FONT FACE="Helvetica">
  137.     <BR><BR>
  138.     <I>Web site design by:</I><BR>
  139.     <A HREF="http://www.gd-ind.com">GLOBAL DATA INDUSTRIES</A>
  140.     </CENTER>
  141.     </FONT>
  142.     </BODY>
  143.     </HTML>
  144. }
  145.  
  146.  
  147.  
  148.  
  149.  
  150. ##########################################################
  151. # Print finished message & dialog
  152.  
  153. &msgbox("Script finished!")
  154. &cls
  155. &print("HTML generation complete. Click the HTML button to view the results.")
  156. &print
  157. &print
  158.  
  159. # END OF SCRIPT
  160.  
  161.  
  162.  
  163.  
  164.  
  165. ##########################################################
  166. # SUBROUTINES
  167.  
  168.  
  169.  
  170.  
  171.  
  172. ############################################################
  173. # The following subroutine is used to generate the DATA HTML
  174. # pages (The pages linked to the top-level page)
  175.  
  176. &defsub("datapage")
  177. {
  178.     # Print progress message
  179.     &print("Processing Jobs ?rownumber?-?var1?")
  180.  
  181.     &html("content?rownumber?.html")
  182.     {
  183.         <HTML>
  184.         <HEAD>
  185.         <TITLE>Jobs ?rownumber?-?var1?</TITLE>
  186.         </HEAD>
  187.         <BODY BACKGROUND="wwbg1.gif" LINK=BLACK VLINK=BLACK ALINK=WHITE>
  188.         <FONT FACE="Verdana,Helvetica">
  189.         <TABLE WIDTH="80%" CELLSPACING=10 BORDER=0>
  190.         <TR>
  191.         <TD><IMG SRC="wwbullet1.gif"></TD>
  192.         <TD>
  193.         <FONT SIZE="+3" FACE="Verdana,Helvetica">
  194.         Jobs ?rownumber?-?var1?
  195.         </FONT>
  196.         </TD>
  197.         </TR>
  198.         </TABLE>
  199.         <UL><UL>
  200.         <BR>
  201.  
  202.         # print out the job details, the max. number of jobs
  203.         # that will be put on each page is set by ?categorysize?
  204.         &foreachrow(?categorysize?)
  205.         {
  206.             <B>?JobTitle?</B>
  207.             <BR>
  208.             <TT>?JobDesc?</TT>
  209.             <BR><BR><BR>
  210.         }
  211.  
  212.         </UL></UL>
  213.         </FONT>
  214.         </BODY>
  215.         </HTML>
  216.     }
  217. }
  218.